resource "huaweicloud_obs_bucket" "log_bucket" {
  bucket = "my-tf-log-bucket"
  acl    = "log-delivery-write"
}

resource "huaweicloud_obs_bucket" "huawei_obs" {
  bucket = "my-tf-test-bucket"
  acl    = "private"

  storage_class = "WARM"
  
  tags = {
    foo = "bar"
    Env = "Test"
  }

  encryption = true
  versioning = true

  logging {
    target_bucket = huaweicloud_obs_bucket.log_bucket.id
    target_prefix = "log/"
  }
  
  website {
    index_document = "index.html"
    error_document = "error.html"
  }

  lifecycle_rule {
    name = "xxn_lifecycle_rule"
    enabled = true
    expiration {
      days = 30
    }
  }
}